local thbattle__fulanduolu_kuangxiao = fk.CreateSkill {

  name = "thbattle__fulanduolu_kuangxiao",

  tags = { Skill.Compulsory, },

}



thbattle__fulanduolu_kuangxiao:addEffect(fk.DrawNCards, {
  prompt = "#thbattle__fulanduolu_kuangxiao",
  anim_type = "offensive",
  on_cost=function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player,{skill_name=thbattle__fulanduolu_kuangxiao.name})
  end,
  on_use = function(self, event, target, player, data)
    data.n = data.n - 1
    if data.n < 0 then data.n = 0 end
    THB_Utility.setStatusMark(player, "@@thbattle__fulanduolu_kuangxiao-turn")
  end
})

thbattle__fulanduolu_kuangxiao:addEffect("targetmod", {
  bypass_times = function(self, player, skill, scope, card, to)
    return player:getMark("@@thbattle__fulanduolu_kuangxiao-turn") > 0 and card and card.trueName == "slash"
        and to:getMark("thbattle__fulanduolu_kuangxiao_target-phase") == 0 and scope == Player.HistoryPhase
        and player:hasSkill(thbattle__fulanduolu_kuangxiao.name)
  end,
})

thbattle__fulanduolu_kuangxiao:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(thbattle__fulanduolu_kuangxiao.name) and
        player:getMark("@@thbattle__fulanduolu_kuangxiao-turn") > 0
        and data.card and (data.card.trueName == "slash" or data.card.trueName == "duel")
  end,
  on_use = function(self, event, target, player, data)
    data.damage = (data.damage or 0) + 1
  end
})

thbattle__fulanduolu_kuangxiao:addEffect(fk.TargetSpecified, {
  can_refresh = function(self, event, target, player, data)
    return target == player and player:hasSkill(thbattle__fulanduolu_kuangxiao.name) and data.card and data.card.trueName == "slash" and
        player:getMark("@@thbattle__fulanduolu_kuangxiao-turn") > 0
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    local targetplayer = data.to
    room:addPlayerMark(targetplayer, "thbattle__fulanduolu_kuangxiao_target-phase")
  end,
})

return thbattle__fulanduolu_kuangxiao